package dto_pakinfo;
// Generated Mar 20, 2013 5:08:51 PM by Hibernate Tools 3.2.1.GA

import dto.*;
import dto_pakinfo.User;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Profile generated by hbm2java
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Profile", propOrder = {
    "id",
    "firstname",
    "lastname",
    "email",
    "address",
    "phoneNumber"
})
@Entity
@Table(name = "Profile", schema = "dbo", catalog = "AntiqueShop")
@XmlRootElement(namespace="http://xml.netbeans.org/schema/profile")
public class Profile implements java.io.Serializable {

    @XmlElement(name = "ProfileId", required = true, namespace="http://xml.netbeans.org/schema/profile")
    private int id;
    @XmlTransient
    private User user;
    @XmlElement(required = true, namespace="http://xml.netbeans.org/schema/profile")
    private String firstname;
    @XmlElement(required = true, namespace="http://xml.netbeans.org/schema/profile")
    private String lastname;
    @XmlElement(required = true, namespace="http://xml.netbeans.org/schema/profile")
    private String email;
    @XmlElement(required = true, namespace="http://xml.netbeans.org/schema/profile")
    private String address;
    @XmlElement(required = true, namespace="http://xml.netbeans.org/schema/profile")
    private String phoneNumber;

    public Profile() {
    }

    public Profile(int id, User user, String firstname, String lastname, String email, String address) {
        this.id = id;
        this.user = user;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.address = address;
    }

    public Profile(int id, User user, String firstname, String lastname, String email, String address, String phoneNumber) {
        this.id = id;
        this.user = user;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.address = address;
        this.phoneNumber = phoneNumber;
    }

    @Id    
    @GeneratedValue(generator = "customForeignGenerator")
    @Column(name = "id", unique = true, nullable = false)
    @GenericGenerator(name = "customForeignGenerator", strategy = "foreign", parameters =
    @Parameter(name = "property", value = "user"))    
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

//    @OneToOne(optional=false)
//    @JoinColumn(name="id")
    @OneToOne(cascade = CascadeType.ALL)
    @PrimaryKeyJoinColumn
    public User getUser() {
        return this.user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Column(name = "firstname", nullable = false)
    public String getFirstname() {
        return this.firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    @Column(name = "lastname", nullable = false)
    public String getLastname() {
        return this.lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    @Column(name = "email", nullable = false)
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name = "address", nullable = false)
    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Column(name = "phone_number")
    public String getPhoneNumber() {
        return this.phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
}
